home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / news / rn / Pnews.header < prev    next >
Encoding:
Text File  |  1989-05-26  |  3.8 KB  |  184 lines

  1. case $# in
  2. 0)
  3.     ng=h
  4.     while $test "$ng" = h ; do
  5.     $echo ""
  6.     $echo $n "Newsgroup(s): $c"
  7.     read ng
  8.     case $ng in
  9.     h)
  10.         $cat <<'EOH'
  11.  
  12. Type the name of one or more newsgroups to which you wish to post an article.
  13. If you want to post to multiple newsgroups, it is better to do them all at
  14. once than to post to each newsgroup individually, which defeats the news
  15. reading programs' strategies of eliminating duplicates.
  16.  
  17. Separate multiple newsgroup names with commas.
  18. EOH
  19.         ;;
  20.     esac
  21.     done
  22.     ;;
  23. *)
  24.     ng=$1
  25.     shift
  26.     ;;
  27. esac
  28. case $ng in
  29. *\ *)
  30.     ng=`$echo "$ng" | $sed 's/[, ] */,/g'`
  31.     ;;
  32. esac
  33. case $ng in
  34. net.*|mod.*|comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*)
  35.     defdist=world
  36.     dist=h
  37.     ;;
  38. *.*)
  39.     defdist=`expr "X$ng" : 'X\([a-z0-9]*\)'`
  40.     dist=h
  41.     ;;
  42. *)
  43.     defdist=''
  44.     dist=''
  45.     ;;
  46. esac
  47.  
  48. while $test "$dist" = h ; do
  49.     if $test -f $lib/distributions; then
  50.     $echo " "
  51.     $echo "Your local distribution prefixes are:"
  52.     $cat $lib/distributions
  53.     $echo " "
  54.     else
  55.     $egrep -v '[     ]none$' <<EOM
  56.  
  57. Your local distribution prefixes are:
  58.     Local organization:    $loc
  59.     Organization:        $org
  60.     City:            $city
  61.     $stpr:          $state
  62.     Country:        $cntry
  63.     Continent:        $cont
  64.     Everywhere:        world
  65.  
  66. EOM
  67.     fi
  68.     $echo $n "Distribution ($defdist): $c"
  69.     read dist
  70.     case $dist in
  71.     '') dist=$defdist ;;
  72.     esac
  73.     case $dist in
  74.     h)
  75.     $cat <<'EOH'
  76.  
  77. The Distribution line may be used to limit the distribution of an article
  78. to some subset of the systems that would receive the article based only on
  79. the Newsgroups line.  For example, if you want to sell your car in talk.auto,
  80. and you live in New Jersey, you might want to put "nj" on the Distribution
  81. line to avoid advertising in California, which has enough problems of its own.
  82. The actual area designators to use depend on where you are, of course.
  83. EOH
  84.     ;;
  85.     ''|$loc*|$org*|$city*|$state*|$cntry*|$cont*|$defdist)
  86.     ;;
  87.     net*|world*|comp*|news*|sci*|rec*|misc*|soc*|talk*)
  88.     dist=''
  89.     ;;
  90.     *)  
  91.     if $test -f $lib/distributions && \
  92.       $egrep "^$dist[     ]" $lib/distributions >$tmpart && \
  93.       $test -s $tmpart; then
  94.         : null
  95.     else
  96.         $echo "Unrecognized distribution prefix--type h for help, CR to use anyway."
  97.         defdist=$dist
  98.         dist=h
  99.     fi
  100.     ;;
  101.     esac
  102. done
  103.  
  104. case $ng in
  105. *net.general*)
  106.     follow=`echo "$ng" | sed 's/net\.general/net.followup/g'`
  107.     ;;
  108. *)
  109.     follow=""
  110.     ;;
  111. esac
  112.  
  113. case $# in
  114. 0)
  115.     title=h
  116.     while $test "$title" = h ; do
  117.     $echo ""
  118.     $echo $n "Title/Subject: $c"
  119.     read title
  120.     case $title in
  121.     h)
  122.         $cat <<'EOH'
  123.  
  124. Type the title for your article.  Please make it as informative as possible
  125. (within reason) so that people who aren't interested won't have to read the
  126. article to find out they aren't interested.  This includes marking movie
  127. spoilers as (spoiler), and rotated jokes as (rot 13).
  128. EOH
  129.     ;;
  130.     esac
  131.     done
  132.     ;;
  133. *)
  134.     title="$*"
  135.     ;;
  136. esac
  137.  
  138. # now build a file with a header for them to edit
  139.  
  140. set X ${USER-${LOGNAME-`who am i`}}
  141. shift
  142. logname=$1
  143. case $logname in
  144. *!*) logname=`expr "$logname" : '!\(.*\)$'` ;;
  145. esac
  146. case ${NAME-$nametype} in
  147. bsd)
  148.     fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  149.     case $fullname in
  150.     *'&'*) : GACK
  151.     lname=`$echo $logname | $tr 'a-z' 'A-Z'`
  152.     lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
  153.     fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
  154.     ;;
  155.     esac
  156.     ;;
  157. usg)
  158.     fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q" -e "}" -e "d"`
  159.     ;;
  160. *)
  161.     fullname=${NAME-`$cat $dotdir/.fullname`}
  162.     ;;
  163. esac
  164.  
  165. orgname=${ORGANIZATION-$orgname}
  166. case $orgname in
  167. /*) orgname=`$cat $orgname` ;;
  168. esac
  169.  
  170. $cat > $tmpart <<EOHeader
  171. Newsgroups: $ng
  172. Subject: $title
  173. Expires: 
  174. References: 
  175. Sender: 
  176. Reply-To: $logname@$sitename.UUCP ($fullname)
  177. Followup-To: $follow
  178. Distribution: $dist
  179. Organization: $orgname
  180. Keywords: 
  181.  
  182. EOHeader
  183.  
  184.